Browse Source

Адаптировал под логины в БД

Кинетик 5 years ago
parent
commit
fec1c4e40a
3 changed files with 15 additions and 5 deletions
  1. 10 0
      MephorceAuth.iml
  2. 2 2
      src/controller/controller.java
  3. 3 3
      web/WEB-INF/views/index.jsp

+ 10 - 0
MephorceAuth.iml

@@ -25,6 +25,16 @@
         <deploymentDescriptor name="hibernate.cfg.xml" url="file://$MODULE_DIR$/src/hibernate.cfg.xml" />
       </configuration>
     </facet>
+    <facet type="web" name="Web2">
+      <configuration>
+        <descriptors>
+          <deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/lib/spring-core-4.3.4.RELEASE.jar" />
+        </descriptors>
+        <webroots>
+          <root url="file://$MODULE_DIR$/lib" relative="/WEB-INF" />
+        </webroots>
+      </configuration>
+    </facet>
   </component>
   <component name="NewModuleRootManager" inherit-compiler-output="true">
     <exclude-output />

+ 2 - 2
src/controller/controller.java

@@ -33,9 +33,9 @@ public class controller {
         HashMap<String, UsersEntity> userDict = UsersDao.getUserList();
         if(userDict.containsKey(user.getName())){
             if(userDict.get(user.getName()).getUserPassword().equals(user.getPassword())){
-                if(Objects.equals(user.getName(), "admin")){
+                if(Objects.equals(user.getName(), "модератор")){
                     modelAndView.setViewName("adminBar");
-                } else if(Objects.equals(user.getName(), "owner")){
+                } else if(Objects.equals(user.getName(), "заказчик")){
                     modelAndView.setViewName("ownerBar");
                 } else {
                     modelAndView.setViewName("studentBar");

+ 3 - 3
web/WEB-INF/views/index.jsp

@@ -37,9 +37,9 @@
   <h1>Вход в систему</h1>
   <spring:form method="post"  modelAttribute="userJSP" action="check-user">
      <spring:select path="name" type="text" value="" placeholder="Логин" id="username">
-         <spring:option value="student">Исполнитель</spring:option>
-         <spring:option value="admin">Администратор</spring:option>
-         <spring:option value="owner">Заказчик</spring:option>
+         <spring:option value="исполнитель">Исполнитель</spring:option>
+         <spring:option value="модератор">Администратор</spring:option>
+         <spring:option value="заказчик">Заказчик</spring:option>
      </spring:select> <br/>
      <spring:input path="password" type="password" value="" placeholder="Пароль" id="password"/>   <br/>
     ${message}<br/>