Abstract connection method
This commit is contained in:
parent
92fe03d81c
commit
fd80f23112
2 changed files with 11 additions and 6 deletions
|
@ -3,6 +3,8 @@ from django.contrib.auth.models import AbstractUser
|
|||
from django.db import models
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
from .staticdefs import CONNECTION_METHODS
|
||||
|
||||
# #############################################################################
|
||||
# Models regarding an election
|
||||
# #############################################################################
|
||||
|
@ -114,9 +116,5 @@ class User(AbstractUser):
|
|||
return election.restricted and (self.election == election)
|
||||
|
||||
def connection_method(self):
|
||||
if self.election is None:
|
||||
if self.username.split("__")[0] == "pwd":
|
||||
return _("mot de passe")
|
||||
return _("CAS")
|
||||
|
||||
return _("identifiants spécifiques")
|
||||
method = self.username.split("__")[0]
|
||||
return CONNECTION_METHODS.get(method, _("identifiants spécifiques"))
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
MAIL_VOTERS = (
|
||||
"Dear {full_name},\n"
|
||||
"\n"
|
||||
|
@ -10,3 +12,8 @@ MAIL_VOTERS = (
|
|||
"-- \n"
|
||||
"Kadenios"
|
||||
)
|
||||
|
||||
CONNECTION_METHODS = {
|
||||
"pwd": _("mot de passe"),
|
||||
"cas": _("CAS"),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue