MCPcopy Index your code
hub / github.com/ddserver/ddserver / login

Method login

ddserver/interface/user.py:69–98  ·  view source on GitHub ↗

Tries to authenticate the session. @param username: the name of the user to authenticate @param password: the password for the user

(self,
            session,
            messages,
            username,
            password)

Source from the content-addressed store, hash-verified

67 @require(session = 'ddserver.interface.session:SessionManager',
68 messages = 'ddserver.interface.message:MessageManager')
69 def login(self,
70 session,
71 messages,
72 username,
73 password):
74 ''' Tries to authenticate the session.
75
76 @param username: the name of the user to authenticate
77 @param password: the password for the user
78 '''
79
80 user = self[username]
81
82 if not user or not pwd.verify(password, user.password):
83 messages.error('The username or password you entered was incorrect.')
84
85 return False
86
87 elif not user.active:
88 messages.error('This account has not yet been activated.')
89
90 return False
91
92 else:
93 session.username = username
94 session.save()
95
96 messages.success('Welcome, %s' % username)
97
98 return True
99
100
101

Callers 1

post_loginFunction · 0.80

Calls 3

errorMethod · 0.80
saveMethod · 0.80
successMethod · 0.80

Tested by

no test coverage detected