Changeset 5777 for main/waeup.sirp/trunk/src
- Timestamp:
- 22 Feb 2011, 09:04:28 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/browser.py
r5775 r5777 144 144 # XXX: Lock the form for editing... 145 145 return 146 147 class Login_PDE(LoginPage):148 grok.context(IWAeUPObject)149 grok.name('login_pde')150 151 title = 'PDE Login'152 pnav = 1153 154 def update(self):155 """Validate credentials and redirect or show error.156 157 The real validation is done by an pluggable authentication158 utility (PAU). Here we only check, whether correct credentials159 were entered by looking up the principal status of the160 request: If the user authenticated successfully, we get an161 applicant principal. Otherwise we get the unauthenticated162 principal.163 """164 formfields = ['form.ac_number', 'form.jamb_reg_no',165 'form.ac_series', 'form.prefix',]166 167 self.reg_no = self.request.form.get('form.jamb_reg_no', '')168 self.ac_series = self.request.form.get('form.ac_series', '')169 self.ac_number = self.request.form.get('form.ac_number', '')170 171 for required_field in formfields:172 if required_field not in self.request.form.keys():173 return174 self.reg_no = self.request.form['form.jamb_reg_no']175 self.ac_series = self.request.form['form.ac_series']176 self.ac_number = self.request.form['form.ac_number']177 principal = self.request.principal178 if not IApplicantPrincipal.providedBy(principal):179 self.flash('You entered invalid credentials')180 return181 if hasattr(principal, 'reg_no'):182 if not principal.reg_no is None:183 184 site = grok.getSite()185 applications = site['applications']186 application = applications[principal.reg_no]187 self.redirect(self.url(application, '@@edit'))188 return189 190 def getCurrentSession(self):191 """Get the current session.192 193 XXX: This should be computed or retrieved from elsewhere.194 195 `session` here means an academic session, not a browser196 session.197 """198 return u'2010/2011'199 200 def getDeadline(self):201 """Get application submission deadline.202 203 XXX: This should be computed or retrieved from elsewhere.204 """205 return u"""Application submission deadline is at Midnight on Friday,206 01. October 2010. No application will be treated207 after the deadline."""208 209 def getApplicantData(self, reg_no, ac):210 """Validate credentials and return applicant data.211 212 Returns tuple ``(<APPLICANT_ENTRY>, <ACCESSCODE>) on213 successful validation and ``None`` else.214 215 We expect a JAMB registration number and an access code in216 format ``PUDE-XXX-XXXXXXXXXX``.217 218 See219 :func:`waeup.sirp.jambtables.util.get_applicant_data`220 for details.221 """222 return get_applicant_data(reg_no, ac)
Note: See TracChangeset for help on using the changeset viewer.