Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Can I make a login menu that works with Apple’s built-in password manager?

in Questions Posts: 16

Hi everyone!
I’m making a little app for a friend at the moment, and I need to make a login menu so people can use it. I know (sort of) how to make a login menu, but I’m not sure it will be compatible with Apple’s “Keychain” feature. Any ideas?

Comments

  • Posts: 1,278

    You could pop up a web browser showing a login/register page, you’d have to code that page though.

  • dave1707dave1707 Mod
    Posts: 9,420

    @DJMoffinz Don’t know if anything like this would help. Wrote this a long time ago. After going to a url, tap Done in the upper right to exit back to the menu code. Maybe this would give you an idea of something to try or maybe it won’t be anything useful at all.

    viewer.mode=FULLSCREEN
    
    function setup() 
        func=menu    -- start screen
    
        buttonTab={}    -- buttons table
    
        -- buttons that show on the menu screen
        table.insert(buttonTab,button(350,600,100,50,"Screen 1",menu,screen1))
        table.insert(buttonTab,button(350,500,100,50,"Screen 2",menu,screen2))
        table.insert(buttonTab,button(350,400,100,50,"Screen 3",menu,screen3))
        table.insert(buttonTab,button(700,50,100,50,"EXIT",menu,close))
    
        -- buttons that show on screen1
        table.insert(buttonTab,button(350,600,150,50,"Google",screen1,url1))
        table.insert(buttonTab,button(350,500,150,50,"twolivesleft",screen1,url2))
        table.insert(buttonTab,button(350,100,150,50,"Menu",screen1,menu))
    
        -- buttons that show on screen2
        table.insert(buttonTab,button(350,600,150,50,"GoogleMaps",screen2,url3))
        table.insert(buttonTab,button(350,100,150,50,"Menu",screen2,menu))
    
        -- buttons that show on screen3
        table.insert(buttonTab,button(350,600,150,50,"amazon",screen3,url4))    
        table.insert(buttonTab,button(350,100,150,50,"Menu",screen3,menu))
    end
    
    function draw()
        background(228, 220, 106)
        func()    -- call the function set by the button
    end
    
    function touched(t)    -- check if a button was pressed
        if t.state==BEGAN then
            for a,b in ipairs(buttonTab) do
                if b:touched(t) then
                    break
                end                
            end
        end
    end
    
    function menu()
        background(223, 177, 152)
        fontSize(30)
        text("Menu Screen",350,700)
        drawButtonTab()
    end
    
    function screen1()
        background(211, 220, 157)
        fontSize(30)
        text("Screen 1",350,700)
        drawButtonTab()
    end
    
    function screen2()
        background(110, 165, 74, 255)
        fontSize(30)
        text("Screen 2",350,700)
        drawButtonTab()
    end
    
    function screen3()
        background(224, 137, 179)
        fontSize(30)
        text("Screen 3",350,700)
        drawButtonTab()
    end
    
    function url1()
        openURL('http://www.google.com',true)
        func=screen1    -- return to screen1
    end
    
    function url2()
        openURL('http://twolivesleft.com',true)
        func=screen1    -- return to screen2
    end
    
    function url3()
        --openURL('http://www.mapquest.com',true)
        openURL('http://www.googlemaps.com',true)
        func=screen2    -- return to screen3
    end
    
    function url4()
        openURL('http://www.amazon.com',true)
        func=screen3    -- return to screen4
    end
    
    function drawButtonTab()    -- draw selected buttons from button table
        fontSize(20)
        for a,b in ipairs(buttonTab) do
            b:draw()
        end
    end    
    
    button=class()
    
    function button:init(x,y,w,h,name,screen,func)
        self.x=x    -- x position
        self.y=y    -- y position
        self.w=w    -- width
        self.h=h    -- height
        self.name=name    -- name to put on the button 
        self.screen=screen -- screen to draw the button on
        self.func=func    -- function to call when the button is pressed
    end
    
    function button:draw()
        if func==self.screen then    -- draw the button
            sprite(asset.builtin.Cargo_Bot.Dialogue_Button,self.x,self.y,120)
            fill(255, 0, 0, 255)
            text(self.name,self.x,self.y)
        end
    end
    
    function button:touched(t)
        if func==self.screen then    -- only check current screen button 
            if t.x>self.x-self.w/2 and t.x<self.x+self.w/2 and
                t.y>self.y-self.h/2 and t.y<self.y+self.h/2 then
                    func=self.func
                    return true
            end
            return false
        end
    end
    
Sign In or Register to comment.