no need to store salt

This commit is contained in:
leca 2024-06-14 02:06:47 +03:00
parent 4dee438cf7
commit 2f8b01d234
3 changed files with 25 additions and 29 deletions

View File

@ -3,8 +3,7 @@ CREATE TABLE IF NOT EXISTS Users (
lastname VARCHAR(32), lastname VARCHAR(32),
firstname VARCHAR(32), firstname VARCHAR(32),
middlename VARCHAR(32), middlename VARCHAR(32),
password_hash CHAR(60), --nodejs bcrypt. salty_password CHAR(60), --nodejs bcrypt.
salt CHAR(29), -- nodejs bcrypt.
chats INT[] -- to table Chats, column ID. chats INT[] -- to table Chats, column ID.
); );

View File

@ -1,11 +1,11 @@
<mxfile host="app.diagrams.net" modified="2024-06-11T11:00:11.476Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" etag="D0Ei79GTjtOxs9i7zUn2" version="24.5.2" type="device"> <mxfile host="app.diagrams.net" modified="2024-06-13T23:05:34.480Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36" etag="i2ECg4nb_4jSL15gzb7W" version="24.5.3" type="device">
<diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1"> <diagram id="C5RBs43oDa-KdzZeNtuy" name="Page-1">
<mxGraphModel dx="1279" dy="748" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0"> <mxGraphModel dx="1674" dy="748" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
<root> <root>
<mxCell id="WIyWlLk6GJQsqaUBKTNV-0" /> <mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" /> <mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
<mxCell id="GfNOIcLhO2e9G-0w8RP9-0" value="Users" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1"> <mxCell id="GfNOIcLhO2e9G-0w8RP9-0" value="Users" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry y="80" width="240" height="240" as="geometry" /> <mxGeometry y="80" width="240" height="210" as="geometry" />
</mxCell> </mxCell>
<mxCell id="GfNOIcLhO2e9G-0w8RP9-1" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1"> <mxCell id="GfNOIcLhO2e9G-0w8RP9-1" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1">
<mxGeometry y="30" width="240" height="30" as="geometry" /> <mxGeometry y="30" width="240" height="30" as="geometry" />
@ -13,70 +13,67 @@
<mxCell id="GfNOIcLhO2e9G-0w8RP9-2" value="lastname VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1"> <mxCell id="GfNOIcLhO2e9G-0w8RP9-2" value="lastname VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1">
<mxGeometry y="60" width="240" height="30" as="geometry" /> <mxGeometry y="60" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-1" value="firstname VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="GfNOIcLhO2e9G-0w8RP9-0"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-1" value="firstname VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1">
<mxGeometry y="90" width="240" height="30" as="geometry" /> <mxGeometry y="90" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-2" value="middlename VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="GfNOIcLhO2e9G-0w8RP9-0"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-2" value="middlename VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1">
<mxGeometry y="120" width="240" height="30" as="geometry" /> <mxGeometry y="120" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="GfNOIcLhO2e9G-0w8RP9-3" value="password_hash CHAR(60)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1"> <mxCell id="GfNOIcLhO2e9G-0w8RP9-3" value="salty_password&lt;span style=&quot;background-color: initial;&quot;&gt;&amp;nbsp;CHAR(60)&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1">
<mxGeometry y="150" width="240" height="30" as="geometry" /> <mxGeometry y="150" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-0" value="salt CHAR(29)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="GfNOIcLhO2e9G-0w8RP9-0"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-4" value="chats INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="GfNOIcLhO2e9G-0w8RP9-0" vertex="1">
<mxGeometry y="180" width="240" height="30" as="geometry" /> <mxGeometry y="180" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-4" value="chats INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="GfNOIcLhO2e9G-0w8RP9-0"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-5" value="Chats" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry y="210" width="240" height="30" as="geometry" />
</mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-5" value="Chats" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1">
<mxGeometry x="687" y="110" width="140" height="150" as="geometry" /> <mxGeometry x="687" y="110" width="140" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-6" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-5"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-6" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-5" vertex="1">
<mxGeometry y="30" width="140" height="30" as="geometry" /> <mxGeometry y="30" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-7" value="name VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-5"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-7" value="name VARCHAR(32)" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-5" vertex="1">
<mxGeometry y="60" width="140" height="30" as="geometry" /> <mxGeometry y="60" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-21" value="admins&lt;span style=&quot;background-color: initial;&quot;&gt;&amp;nbsp;INT[]&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-5"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-21" value="admins&lt;span style=&quot;background-color: initial;&quot;&gt;&amp;nbsp;INT[]&lt;/span&gt;" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-5" vertex="1">
<mxGeometry y="90" width="140" height="30" as="geometry" /> <mxGeometry y="90" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-8" value="messages INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-5"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-8" value="messages INT[]" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-5" vertex="1">
<mxGeometry y="120" width="140" height="30" as="geometry" /> <mxGeometry y="120" width="140" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-9" value="Messages" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" vertex="1" parent="WIyWlLk6GJQsqaUBKTNV-1"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-9" value="Messages" style="swimlane;fontStyle=0;childLayout=stackLayout;horizontal=1;startSize=30;horizontalStack=0;resizeParent=1;resizeParentMax=0;resizeLast=0;collapsible=1;marginBottom=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
<mxGeometry x="360" y="360" width="240" height="150" as="geometry" /> <mxGeometry x="360" y="360" width="240" height="150" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-10" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-9"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-10" value="ID SERIAL" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-9" vertex="1">
<mxGeometry y="30" width="240" height="30" as="geometry" /> <mxGeometry y="30" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-11" value="author_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-9"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-11" value="author_id INT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-9" vertex="1">
<mxGeometry y="60" width="240" height="30" as="geometry" /> <mxGeometry y="60" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-12" value="time_sent TIMESTAMP" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-9"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-12" value="time_sent TIMESTAMP" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-9" vertex="1">
<mxGeometry y="90" width="240" height="30" as="geometry" /> <mxGeometry y="90" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-23" value="content TEXT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" vertex="1" parent="5QsmdMTZOQ-KcOoPIG_9-9"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-23" value="content TEXT" style="text;strokeColor=none;fillColor=none;align=left;verticalAlign=middle;spacingLeft=4;spacingRight=4;overflow=hidden;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;rotatable=0;whiteSpace=wrap;html=1;" parent="5QsmdMTZOQ-KcOoPIG_9-9" vertex="1">
<mxGeometry y="120" width="240" height="30" as="geometry" /> <mxGeometry y="120" width="240" height="30" as="geometry" />
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-17" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToMany;startArrow=ERmandOne;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-4" target="5QsmdMTZOQ-KcOoPIG_9-6"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-17" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToMany;startArrow=ERmandOne;rounded=0;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-4" target="5QsmdMTZOQ-KcOoPIG_9-6" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="400" y="370" as="sourcePoint" /> <mxPoint x="400" y="370" as="sourcePoint" />
<mxPoint x="500" y="270" as="targetPoint" /> <mxPoint x="500" y="270" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-20" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToOne;startArrow=ERmandOne;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-8" target="5QsmdMTZOQ-KcOoPIG_9-10"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-20" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToOne;startArrow=ERmandOne;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-8" target="5QsmdMTZOQ-KcOoPIG_9-10" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="160" y="500" as="sourcePoint" /> <mxPoint x="160" y="500" as="sourcePoint" />
<mxPoint x="260" y="400" as="targetPoint" /> <mxPoint x="260" y="400" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-22" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToMany;startArrow=ERmandOne;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-21" target="GfNOIcLhO2e9G-0w8RP9-1"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-22" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToMany;startArrow=ERmandOne;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-21" target="GfNOIcLhO2e9G-0w8RP9-1" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="505" y="550" as="sourcePoint" /> <mxPoint x="505" y="550" as="sourcePoint" />
<mxPoint x="815" y="440" as="targetPoint" /> <mxPoint x="815" y="440" as="targetPoint" />
</mxGeometry> </mxGeometry>
</mxCell> </mxCell>
<mxCell id="5QsmdMTZOQ-KcOoPIG_9-24" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToOne;startArrow=ERmandOne;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-11" target="GfNOIcLhO2e9G-0w8RP9-1"> <mxCell id="5QsmdMTZOQ-KcOoPIG_9-24" value="" style="edgeStyle=entityRelationEdgeStyle;fontSize=12;html=1;endArrow=ERzeroToOne;startArrow=ERmandOne;rounded=0;exitX=0;exitY=0.5;exitDx=0;exitDy=0;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="5QsmdMTZOQ-KcOoPIG_9-11" target="GfNOIcLhO2e9G-0w8RP9-1" edge="1">
<mxGeometry width="100" height="100" relative="1" as="geometry"> <mxGeometry width="100" height="100" relative="1" as="geometry">
<mxPoint x="150" y="480" as="sourcePoint" /> <mxPoint x="150" y="480" as="sourcePoint" />
<mxPoint x="250" y="380" as="targetPoint" /> <mxPoint x="250" y="380" as="targetPoint" />

View File

@ -196,8 +196,8 @@ app.post('/api/register', requireToBeNotLoggedIn, async (req, res) => {
} }
let id = (await client.query( let id = (await client.query(
"INSERT INTO Users (lastname, firstname, middlename, password_hash, salt) VALUES ($1, $2, $3, $4, $5) RETURNING ID;", "INSERT INTO Users (lastname, firstname, middlename, salty_password) VALUES ($1, $2, $3, $4) RETURNING ID;",
[lastname, firstname, middlename, hash, salt] [lastname, firstname, middlename, hash]
)).rows[0].id; )).rows[0].id;
req.session.token = generateRandomString(); req.session.token = generateRandomString();
sessions[req.session.token] = id; sessions[req.session.token] = id;
@ -222,7 +222,7 @@ app.post('/api/login', requireToBeNotLoggedIn, async (req, res) => {
return res.status(400).send("No such user.").end(); return res.status(400).send("No such user.").end();
} }
let stored_password = (await client.query("SELECT password_hash FROM Users WHERE ID = $1;", [ID])).rows[0].password_hash; let stored_password = (await client.query("SELECT salty_password FROM Users WHERE ID = $1;", [ID])).rows[0].salty_password;
if (bcrypt.compareSync(password, stored_password)) { if (bcrypt.compareSync(password, stored_password)) {
req.session.token = generateRandomString() req.session.token = generateRandomString()