summaryrefslogtreecommitdiff
path: root/user/HTC/reguser.htc
blob: 0a5835c8d35b11b02f9f48d60e91c5028e3f3268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
\clearance{ADM}
\alias{RegUser}
\setgroup{\user.group}
\const{CLEARLIST}{\user.group HTC}
\page{
  \title{Register User as \group}

  \switch{\T.RES}
  {BEM}{
    \font{color=red}{Bad email.}
  }
  {USEX}{
    \font{color=red}{User already exist.}
  }
  {ERR}{
    \font{color=red}{An error occured - user not added.}
  }

  <p>
  \bf{NOTE:} Remember to use \bf{valid, fully qualified e-mail addresses!}.
  Local network aliases will be added if applicable.
  If you manage multiple groups, make sure you add this person with
  the correct clearance!
  <p>
  A welcome message will be sent to the new user.

  \form{\uri}{
    \table{bgcolor=#dddddd}{
      \tr{
        \td{align=right}{E-mail:}
        \td{colspan=3}{\input{EMAIL}{46}}
      }
      \tr{
        \td{align=right}{Name:}
        \td{colspan=3}{\input{NAME}{46}}
      }
      \tr{
        \td{align=right}{URL:}
        \td{colspan=3}{\input{w.URL}{46}}
      }
      \tr{
        \td{align=right}{Group:}\td{\group}
        \td{align=right}{Clearance:}\td{\CLEARLIST}
      }
      \tr{
        \td{align=right}{Position:}\td{colspan=3}{\select.posit{w.POSIT}{Temp}}
      }
      \tr{
        \td{align=right}{Phone:}\td{\input{w.EXT}{10}}
        \td{align=right}{Room:}\td{\input{w.ROOM}{10}}
      }
      \tr{
        \td{align=right}{Note:}\td{colspan=3}{\input{w.NOTE}{46}}
      }
    }
    <p>
    \button{Register this User}
  }
}
\onpost{
  \if(\T.EMAIL cnt "@" && \T.EMAIL cnt "."){
    \if{\getuser{\T.EMAIL}}{
      \redirect{\this?RES=USEX}
    }{
      \su{\newuser{\CLEARLIST}{\T.EMAIL}{\T.NAME}}{
        \const{T.w.ID}{\user.id};
        \db{PREFS}{\import{@}{T.w.}[LASTMOD=\now]}
        \mail.user{Registration at \server.alias}{
          \user.name, welcome to the \server.alias server at

          \server/
          
          Your alias is: \user.alias
          Your PIN-code is: \user.pin
          
          Please take a minute or two to go through the pages
          and familiarize yourself with the login/logout procedure.

          \server/LOGIN/?alias=\user.alias
          
          /Admin
        }
        \redirect{\pwd/admin.htc?ID=\user.id}
      }{
        \redirect{\this?RES=ERR}
      }
    }
  }{
    \redirect{\this?RES=BEM}
  }
}