login-and-signup
term: account - always references Ubuntu One account of type com.ubuntu with auth token type ubuntuone
New Activities
LoginActivity
account exists with token == null and userData with key authTokenHint != null
true: show ValidateFragment
false: show LoginFragment
New Fragments
LoginFragment
- show log in form
there is an account with token != null
- true: the token is valid?
- true: finish with RESULT_OK
- true: the token is valid?
user hits log in button
- username is different than of an existing account
- true: tell that only one Ubuntu One account is supported, stop
authenticate the user with AuthenticateUserTask
returns AccountNotValidatedException: switch to ValidateFragment
- success: finish with RESULT_OK
- username is different than of an existing account
SignupFragment
- an account already exists
- true: show log in form and tell that only one Ubuntu One account is supported, stop
- false: show sign up form
user hits sign up button
TODO: if the "E-mail already registered", attempt to execute ValidateAccountTask with provided creds
- if all good, register new account
authenticate the user with AuthenticateUserTask
returns AccountNotValidatedException: switch to ValidateFragment
ValidateFragment
- an account does not exist
- show log in form, stop
- tell the user to click the link in the e-mail
every few seconds, as long as fragment is not in paused state, execute ValidateAccountTask
if ValidateAccountTask succeeds, finish with RESULT_OK
New AsyncTasks
RegisterUserTask
- register the user
ValidateAccountTask
use sso api me() method to determine if preferredEmail != null (and != "null")
true: set account token in AccountManager to what userData with authTokenHint holds, and clear userData with authTokenHint key, callback with success
- false: callback with failure
AuthenticateUserTask
- generate an OAuth token for the app
create an account in AccountManager
save the OAuth token as userData with key authTokenHint
switch to ValidateFragment
mkarnicki/u1f/login-and-signup (last edited 2011-11-22 21:15:09 by 178-73-27-165)